package com.itheima.commen;

/** 数据封装,响应给前端
 * @Description:
 * @Version: V1.0
 */
public class Result<T> {
    //操作转态吗
    private Integer code;
    //数据
    private  T data;
    //提示信息
    private String message;

    //状态码,提示信息构造器
    public Result(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Result(String message) {
        this.message = message;
    }

    //数据和提示信息
    public Result(T data, String message) {
        this.data = data;
        this.message = message;
    }
    //全参
    public Result(Integer code, T data, String message) {
        this.code = code;
        this.data = data;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    @Override
    public String toString() {
        return "Result{" + "code=" + code + ", data=" + data + ", message='" + message + '\'' + '}';
    }
}
